package fan.com.httpframe.test.slideshow;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import fan.com.httpframe.R;
import fan.com.httpframe.activity.BaseActivity;
import fan.com.httpframe.convenientbanner.CBViewHolderCreator;
import fan.com.httpframe.convenientbanner.Holder;
import fan.com.httpframe.imageloder.GlideImageLoader;
import fan.com.httpframe.imageloder.progress.CircleProgressView;

/**
 * 文件名：
 * 描述：
 * 作者：梁帆
 * 时间：2018/5/29 0029
 * 版权：
 */

public class SlideShowActivity extends BaseActivity {

    @BindView(R.id.convenientbanner)
    fan.com.httpframe.convenientbanner.ConvenientBanner mConvenientbanner;

    @Override
    protected View onCreateContentView() {
        return inflateContentView(R.layout.test_activity_slideshow);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }

    public void initView() {
        List<Integer> list = new ArrayList<Integer>();
        list.add(R.mipmap.bg_nodata);
        list.add(R.mipmap.ic_empty);
        list.add(R.mipmap.ic_error);
        mConvenientbanner.setPages(new CBViewHolderCreator() {
            @Override
            public Object createHolder() {
                return new AdvViewHolder();
            }
        }, list);
    }

    class AdvViewHolder implements Holder<Integer> {
        private ImageView imageView;
        private CircleProgressView circleProgressView;

        @Override
        public View createView(Context context) {
            View view = inflateContentView(R.layout.test_adv_image);
            imageView = (ImageView) view.findViewById(R.id.glide_image);
            return view;
        }

        @Override
        public void UpdateUI(Context context, final int position, final Integer data) {
            GlideImageLoader.create(imageView).loadLocalImage(data, R.mipmap.ic_launcher);
            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                }
            });

        }
    }

}
